package cn.billy.basic.config;

import cn.billy.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class loginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加登录拦截器
        registry.addInterceptor(loginInterceptor)
                // 拦截所有
                .addPathPatterns("/**")
                // 设置登录拦截器放行接口
                .excludePathPatterns("/login/**",// 放行登录相关接口
                                    "/verifyCode/**",// 放行验证码相关接口
                                    "/fastdfs/**",// 放行fastdfs相关接口
                                    "/shop/settlement",// 放行店铺入驻接口
                                    "/user/register/**");// 放行用户注册接口

    }
}
